import React, {Component} from 'react';

import { observable, autorun, action } from 'mobx';
import { observer } from 'mobx-react';

class MyState {
  @observable num = 0
  @action add = () => {
    this.num ++
  }
}

const myState = new MyState()

@observer
export default class MyMobx extends Component {

  render() {
    return (
      <div>
        <span>{ myState.num }</span>
        <button onClick={myState.add}>点我+1</button>
      </div>
    )
  }
}